import numpy as np
from PyQt4.Qt import *
from PyQt4.Qwt5 import *
from PyQt4.Qwt5.qplt import *
application = QApplication([])
x = np.arange(-2*np.pi, 2*np.pi, 0.01)
p = Plot(
         Curve(x, np.cos(x), Pen(Magenta, 2), "cos(x)"),
         Curve(x, np.exp(x), Pen(Red), "exp(x)", Y2),
         Axis(Y2, Log),
         "PyQwt using Qwt-%s -- http://qwt.sf.net" % QWT_VERSION_STR)
QPixmap.grabWidget(p).save('cli-plot-1.png', 'PNG')

x = x[0:-1:10]
p.plot(
       Curve(x, np.cos(x-np.pi/4), Symbol(Circle, Yellow), "circle"),
       Curve(x, np.cos(x+np.pi/4), Pen(Blue), Symbol(Square, Cyan), "square"))
QPixmap.grabWidget(p).save('cli-plot-2.png', 'PNG')
